package com.shengqi.xinnongren.work.ui.user.activities;

import android.content.Intent;
import android.widget.TextView;

import com.shengqi.xinnongren.R;
import com.shengqi.xinnongren.common.base.BaseMvpActivity;
import com.shengqi.xinnongren.common.md5.SafeUtils;
import com.shengqi.xinnongren.common.utils.LogUtil;
import com.shengqi.xinnongren.work.ui.user.presenter.MyWalletPresenter;
import com.shengqi.xinnongren.work.ui.user.view.MyWalletView;

import org.json.JSONException;
import org.json.JSONObject;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 我的余额
 */
public class MyWalletActivity extends BaseMvpActivity<MyWalletView, MyWalletPresenter> implements MyWalletView {

    @BindView(R.id.tv_balance)
    TextView tv_balance;

    @Override
    protected int setContentLayoutRes() {
        return R.layout.activity_my_wallet;
    }

    @Override
    protected void initView() {

    }

    @OnClick(R.id.tv_money_detail)
    void tv_money_detail() {
        startActivity(new Intent(this, WalletDetailActivity.class));
    }

    /**
     * 立即充值
     */
    @OnClick(R.id.tv_goto_recharge)
    void gotoRecharge() {
        startActivity(new Intent(this, ReChargeActivity.class));
    }

    @Override
    protected void initData() {
        mPresenter.getBalance();
    }

    @Override
    protected MyWalletPresenter createPresenter() {
        return new MyWalletPresenter();
    }

    @Override
    public void showLoadingView() {
        showLoadingDialog();
    }

    @Override
    public void hideLoadingView() {
        hideLoadingDialog();
    }

    @Override
    public void onNetworkError() {
        hideLoadingDialog();
    }

    @Override
    public void showBalanceRes(String respond) {
        tv_balance.setText(respond);
    }

}
